//
//  BGUserPotrocalController.swift
//  Baga
//
//  Created by 飞王 on 16/12/30.
//  Copyright © 2016年 飞王. All rights reserved.
//

import UIKit

class BGUserPotrocalController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupView();

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    private func setupView() {
        
        view.backgroundColor = UIColor.white;
        
        view.addSubview(webView);
        
        makeConstranints();
        
        //加载本地h5
        loadPotrocalFile();
    }
    
    private func loadPotrocalFile() {

        let path = Bundle.main.path(forResource: "user_protocol", ofType: "html");
        let url = NSURL(fileURLWithPath: path!);
        let request = NSURLRequest(url: url as URL);
        webView.loadRequest(request as URLRequest);
    }
    
    private func makeConstranints() {
        webView.snp.makeConstraints { (make) in
            make.top.equalTo(view);
            make.left.equalTo(view);
            make.right.equalTo(view);
            make.bottom.equalTo(view);
        }
    }
    

    // MARK: - lazy load
    
    private lazy var webView: UIWebView = {
        let webView = UIWebView();
        webView.delegate = self;
        return webView;
        
    }()
 

}

extension BGUserPotrocalController: UIWebViewDelegate{
    
    
}
